class Node:
    def __init__(self, data):
        self.data = data
        self.next: Node = None

    def has_next(self):
        return self.next is not None


class LinkedListMap:
    def __init__(self, key):
        self.key = key
        self.head: Node = None
        self.map: dict = {}
        self.tail: Node = None

    def get(self, key) -> Node:
        if key not in self.map.keys():
            return None
        return self.map.get(key)

    def add(self, node: Node):
        if self.head is None:
            self.head = node
        if self.tail is None:
            self.tail = node
        else:
            self.tail.next = node
            self.tail = node
        self.map[node.data.get(self.key)] = node
        while node.has_next():
            self.tail = node.next
            self.map[node.data.get(self.key)] = node
